Skip to content

fix: Fix restartRequired flag#31947

Open
andrei-lazarov wants to merge 1 commit into
Koenkk:devfrom
andrei-lazarov:restartRequired
Open

fix: Fix restartRequired flag#31947
andrei-lazarov wants to merge 1 commit into
Koenkk:devfrom
andrei-lazarov:restartRequired

Conversation

@andrei-lazarov
Copy link
Copy Markdown
Contributor

I found a bug:

  1. Change option that requires restart -> bridge/info/restart_required = true
  2. Change option that does not require restart -> bridge/info/restart_required = false

But of course Z2M still requires a restart to apply the first option.

Also changed the log message to inform the user.

Comment thread lib/extension/bridge.ts
}
await this.publishInfo();
return utils.getResponse(message, {restart_required: this.restartRequired});
return utils.getResponse(message, {restart_required: newRestartRequired});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return utils.getResponse(message, {restart_required: newRestartRequired});
return utils.getResponse(message, {restart_required: this.restartRequired});

should stay required on consecutive saves if any previous save resulted in "required".
Looks like we don't have a test for this?

Copy link
Copy Markdown
Contributor Author

@andrei-lazarov andrei-lazarov May 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it makes sense the response to changing an option should tell if that option needs a restart, not if the system does. (But I don't mind changing it)

For the tests just change some options and see if this.restartRequired is set correctly? settings.test.ts is fine?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it depends if we want the bridge to keep in sync with the per-save response. I guess there's an argument for both 😅
We'd have to change the logic elsewhere too though:

return utils.getResponse(message, {from: oldOptions, to: newOptions, id: ID, restart_required: this.restartRequired});

Frontend uses only bridge/info, so, no effect there.

We should test consecutive changes (through bridge topics) and match resulting bridge/info state and topic response state. In extensions/bridge.test.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants